package com.pet.mapper;

import com.pet.entity.PetInfoQuestionnaire;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PetInfoQuestionnaireMapper {


    /**
     * 添加健康问卷
     * @param petInfoQuestionnaire
     */
    @Insert("INSERT INTO pet_manage_system.pet_information_questionnaire " +
            "(diet_staple, diet_appetite, diet_eat, diet_picky, diet_apastia, " +
            "diet_water, daily_spirit, daily_abnormal_call, daily_abnormal_action, social_respond, " +
            "social_action, excretion_normal, excretion_illness, excretion_urine, excretion_urine_illness, " +
            "sign_smell, sign_hair, sign_hair_illness, sign_height, sign_illness_01, sign_illness_02, pet_id," +
            "vaccine,vaccine_date,extra_info) " +
            "VALUES " +
            "(#{dietStaple}, #{dietAppetite}, #{dietEat}, #{dietPicky}, #{dietApastia}, " +
            "#{dietWater}, #{dailySpirit}, #{dailyAbnormalCall}, #{dailyAbnormalAction}, #{socialRespond}, " +
            "#{socialAction}, #{excretionNormal}, #{excretionIllness}, #{excretionUrine}, #{excretionUrineIllness}, " +
            "#{signSmell}, #{signHair}, #{signHairIllness}, #{signHeight}, #{signIllness01}, #{signIllness02}, #{petId}," +
            "#{vaccine},#{vaccineDate},#{extraInfo})")
    void insertQuestionnaire(PetInfoQuestionnaire petInfoQuestionnaire);

    /**
     * 删除健康问卷
     * @param id
     */
    @Delete("delete from pet_manage_system.pet_information_questionnaire where id = #{id}")
    void deleteQuestionnaire(Integer id);

    /**
     * 根据宠物id获取宠物问卷调查信息
     * @param petId
     * @return
     */
    @Select("select " +
            "id, diet_staple, diet_appetite, diet_eat, diet_picky, diet_apastia, " +
            "diet_water, daily_spirit, daily_abnormal_call, daily_abnormal_action, " +
            "social_respond, social_action, excretion_normal, excretion_illness, excretion_urine," +
            " excretion_urine_illness, sign_smell, sign_hair, sign_hair_illness, sign_height, " +
            "sign_illness_01, sign_illness_02, vaccine ,vaccine_date ,extra_info ,pet_id " +
            "from pet_manage_system.pet_information_questionnaire " +
            "where pet_id = #{petId}")
    List<PetInfoQuestionnaire> selectQuestionnaireList(Integer petId);

    /**
     * 根据petId删除
     * @param id
     */
    @Delete("delete from pet_manage_system.pet_information_questionnaire where pet_id =#{id}")
    void deleteQuestionnaireByPetId(Integer id);

    /**
     * 根据id查询单条内容
     *
     * @param id
     * @return
     */
    @Select("select * from pet_manage_system.pet_information_questionnaire where id =#{id}")
    PetInfoQuestionnaire selectQuestionnaireById(Integer id);

    /**
     * 修改健康问卷
     * @param petInfoQuestionnaire
     */
    void updateQuestionnaire(PetInfoQuestionnaire petInfoQuestionnaire);
}
